home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 12 / BBS in a box XII-2.iso / Files II / Prog / A / About... 2.1.sit / About… 2.1 Intf.p < prev    next >
Encoding:
Text File  |  1992-01-01  |  4.8 KB  |  125 lines  |  [TEXT/PJMM]

  1. unit About;            { version 2.1            last update:  1/1/92 }
  2. {}
  3. {}
  4. {   About… is copyrighted, and I reserve all rights to it; both source and}
  5. {   compiled versions.  Please do not distribute this source without my}
  6. {   permission, or remove this notice.  Thanks.}
  7. {}
  8. {   Jon Wind (About…)}
  9. {   2374 Hillwood Drive}
  10. {   Maplewood, MN  55119}
  11. {}
  12. { 2.1 Changes }
  13. {    Updated demo to work properly with System 7.0 and added popup menu for window types }
  14. {    Improved overall stability of About… unit, especially in tight memory situations }
  15. {    Added support for movableDBoxProc window type }
  16. {    Added support for plainDBox window type to be drawn with only scrollable text }
  17. {}
  18. { 2.0 Changes }
  19. {    Created Modal and Modeless versions }
  20. {    Added optional support for display of styled text }
  21. {    Added support for copying styled text }
  22. {    Added ability to specify how window will be centered instead of just center or not center }
  23. {    Improved error checking in low memory conditions }
  24. {    Shift-command-c will now also copy text }
  25. {    Method of obtaining main window rect should now work for DAs, cdevs, etc }
  26. {    Window dragging now gets bounds from GrayRgn }
  27. {    Window centering routines now shift the window as neccessary to keep it entirely onscreen }
  28. {    Option clicking in the window displays the version instead of option clicking anywhere }
  29. {    OK button is now horizontally centered if MainIcon = NoIcon & Length(WinMsg) = 0; set WinMsg to an invisible character to not center it }
  30. {    OK button is disabled and default roundrect is drawn in gray if the (modeless) About window is not in front }
  31. {    Added support for close box instead of OK button for noGrowDocProc or rDocProc windows }
  32. {    Scrolling text area is extended downward if MainIcon = NoIcon & Length(WinMsg) = 0 }
  33. {    Control and window auxRecs are now used for frame and background colors }
  34. {}
  35. {$R-}
  36. interface
  37.  
  38.  
  39.     const
  40.         AboutVersion = 'About… 2.1';
  41.         AboutNoIcon = -1;
  42.         AboutNoCenter = -1;
  43.         AboutTopCenter = 0;
  44.         AboutMainCenter = 1;
  45.         AboutMsg = 0;
  46.         AboutTEXT = 1;
  47.  
  48.         movableDBoxProc = 5;
  49.  
  50.     type
  51.         AboutFontRec = record
  52.                 Font, Size: Integer;
  53.                 Face: Style;
  54.                 Color: Integer;
  55.             end;
  56.         AboutRec = record
  57.                 FontInfo: array[AboutMsg..AboutTEXT] of AboutFontRec;
  58.                 TEXTCopy, KeyEquivs, CloseBox, Styled: Boolean;
  59.                 CenterMode, MainIcon, ClickIcon: Integer;
  60.                 ClickMsg: Str255;
  61.             end;
  62. { Note: font color(s) must be blackColor, whiteColor, redColor, greenColor, blueColor, cyanColor, magentaColor, or yellowColor }
  63. { Note: if MainIcon = AboutNoIcon then no icon will be drawn }
  64. { Note: if ClickIcon = AboutNoIcon then no icon will be drawn when original icon is clicked on }
  65. { Note: if CenterMode = AboutNoCenter the window will use the supplied coordinates and will not be centered }
  66. { Note: if CenterMode = AboutTopCenter the window will be centered on the front window or the main monitor if there is no front window }
  67. { Note: if CenterMode = AboutMainCenter the window will be centered on the main monitor }
  68. { Note: if Length(ClickMsg) = 0 then no message will be drawn when original icon is clicked on }
  69. { Note: CloseBox will be ignored for dBoxProc, altDBoxProc, and movableDBoxProc windows }
  70.  
  71.  
  72.  
  73. { Modal procedure: }
  74. { this routine does everything, returning to calling proc only after the window is dismissed... }
  75.     procedure BuildAbout (WinRect: Rect;
  76.                                     WinProc, TEXTid: Integer;
  77.                                     WinTitle, WinMsg: Str255;
  78.                                     WinMisc: AboutRec);
  79.  
  80.  
  81. { Modeless procedures: }
  82. { returns true if the specified window is an About window; otherwise returns false }
  83.     function IsAboutWindow (theWindow: WindowPtr): Boolean;
  84.  
  85. { open About window and return pointer to it - returns NIL if window is not created }
  86. { Note: you should keep track of this pointer only if you wish to keep specific track of it }
  87.     function OpenAbout (WinRect: Rect;
  88.                                     WinProc, TEXTid: Integer;
  89.                                     WinTitle, WinMsg: Str255;
  90.                                     WinMisc: AboutRec): WindowPtr;
  91.  
  92. { handle event relating to About window, ie updateEvt, activateEvt, mouseDown, keyDown, etc… }
  93. { Note: this proc should be called after every event for each About window for everything to work correctly }
  94. { Note: this proc calls the CloseAbout proc if the OK button or close box is selected }
  95. { Note: you can filter events passed to it to simulate a modal dialog }
  96.     procedure HandleAbout (var theWindow: WindowPtr;
  97.                                     var theEvent: EventRecord);
  98.  
  99. { close the specified About window, kill data structures associated with it, and set theWindow to NIL… }
  100. { Note: this proc is called by the HandleAbout proc when an About window is dismissed by selecting its OK button }
  101. { Note: this proc should be called when the program needs to remove an About window }
  102.     procedure CloseAbout (var theWindow: WindowPtr);
  103.  
  104.  
  105.  
  106. implementation
  107.  
  108.  
  109.  
  110.     procedure BuildAbout;
  111.     external;
  112.  
  113.     function IsAboutWindow;
  114.     external;
  115.  
  116.     function OpenAbout;
  117.     external;
  118.  
  119.     procedure HandleAbout;
  120.     external;
  121.  
  122.     procedure CloseAbout;
  123.     external;
  124.  
  125. end.